import * as THREE from "three";
import { gsap } from "gsap";

export default class DropUp {
  constructor() {
    this.height = -4;

    this.main = new THREE.Group();
    this.models = [];

    gsap.timeline({ yoyo: true, repeat: -1, repeatDelay: 0 })
      .to(this, { height: 4.5, duration: 2, ease: "power2.inOut" });
  }

  add(mesh) {
    this.models.push(mesh);
  }

  build() {
    this.models.forEach(e => {
      this.main.add(e);
    });
  }

  update() {
    this.main.position.z = this.height;
  }
}